aboutsummaryrefslogtreecommitdiff
path: root/pages/en/manga/[...id].js
diff options
context:
space:
mode:
authorA i j a Z <[email protected]>2023-10-22 21:48:33 +0530
committerGitHub <[email protected]>2023-10-22 23:18:33 +0700
commit100edf23426501e2f2f420ba8a70dd022e4027af (patch)
treecb5326b2a17c270af550ad1bcd6882f916d5be02 /pages/en/manga/[...id].js
parentfixed redis (#94) (diff)
downloadmoopa-100edf23426501e2f2f420ba8a70dd022e4027af.tar.xz
moopa-100edf23426501e2f2f420ba8a70dd022e4027af.zip
fixed redis error for manga (#95)
* fixed schedules * fixed redis * Update [...id].js * Update index.js
Diffstat (limited to 'pages/en/manga/[...id].js')
-rw-r--r--pages/en/manga/[...id].js25
1 files changed, 14 insertions, 11 deletions
diff --git a/pages/en/manga/[...id].js b/pages/en/manga/[...id].js
index 106bce2..6d2b016 100644
--- a/pages/en/manga/[...id].js
+++ b/pages/en/manga/[...id].js
@@ -347,14 +347,14 @@ export async function getServerSideProps(context) {
},
};
} else {
- const getCached = await redis.get(`mangaPage:${mangadexId}`);
+ if (redis) {
+ const getCached = await redis.get(`mangaPage:${mangadexId}`);
- if (getCached) {
- cached = JSON.parse(getCached);
+ if (getCached) {
+ cached = JSON.parse(getCached);
+ }
}
-
// let chapters;
-
if (cached) {
data = cached.data;
info = cached.info;
@@ -389,12 +389,15 @@ export async function getServerSideProps(context) {
color: textColor,
};
- await redis.set(
- `mangaPage:${mangadexId}`,
- JSON.stringify({ data, info, color }),
- "ex",
- 60 * 60 * 24
- );
+ if(redis)
+ {
+ await redis.set(
+ `mangaPage:${mangadexId}`,
+ JSON.stringify({ data, info, color }),
+ "ex",
+ 60 * 60 * 24
+ );
+ }
}
}